<template>
  <div style="padding:10px">
    <el-button v-print="'#print'" size="mini" type="success">打印</el-button>
    <el-button size="mini" type="info" @click="back">返回</el-button>
    <div id="print">
      <h1 style="">{{ name2 }}</h1>
      <p class="font">生产入库单打印</p>
      <table>
        <tr>
          <td style="width:400px">入库单号</td>
          <td style="width:450px">任务编号</td>
          <td style="width:400px">客户名称</td>
          <td style="width:400px">订单数量</td>
          <td style="width:400px">生产数量</td>
          <td style="width:550px">箱型</td>
          <td style="width:450px">单价</td>
          <td style="width:750px">生产时间</td>
          <td style="width:750px">入库时间</td>
        </tr>
        <tr v-for="item in tableData" :key="item.eid">
          <td>{{ item.warehouseNo }}</td>
          <td>{{ item.no }}</td>
          <td>{{ item.name }}</td>
          <td>{{ item.orderNum }}</td>
          <td>{{ item.pnum }}</td>
          <td>{{ item.boxType }}</td>
          <td>{{ item.perPrice }}</td>
          <td>{{ item.proTime }}</td>
          <td>{{ item.inTime }}</td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
import { list } from '@/api/basedata/firm'
export default {
  data() {
    return {
      total: 0,
      name2: '',
      tableData: []
    }
  },
  created() {
    list().then(res => {
      var firmList = []
      firmList = res.list
      firmList.forEach(a => {
        if (a.isFirm === true) {
          this.name2 = a.name
        }
      })
    })
    var object = this.$route.query
    var array = []
    for (const key in object) {
      if (key === '2') {
        array.push(object[key])
      } else if (key === '1') {
        array = object[key]
      }
    }
    this.tableData = array
  },
  methods: {
    back() {
      this.$router.push('./inwarehouse')
    }
  }
}
</script>

<style scoped>
.el-link{
  color: rgb(0, 162, 255);
  font: 1em sans-serif;
}
.font{
  font-weight: bold;
  width: 1050px;
  margin: 0 auto;
  text-align: center;
  margin-top: 20px;
  line-height: 100px;
  font-size: 30px;
  font-family: 'Courier New', Courier, monospace;
  /* text-align: center; */
  /* margin-left: 40%; */
  margin-bottom: 0%;
}
h1{
  /* margin-left: 40%; */
  width: 1050px;
  margin: 0 auto;
text-align: center;
  font-weight: normal;
  margin-bottom: 0%;
  height: 0px;
}
table,tr,td{
  border:1px solid black;
}
table{
  width:1050px;
  border-collapse:collapse;
  height: auto;
  margin: 0 auto;

}
tr{
  height: 35px;
}
table td{
  height: 35px;
}
td{
  width: 150px;
  text-align: center ;
  /* padding-left:15px; */

}
.case{
  display: flex;
  justify-content: space-between;
  width: 1050px;
  margin: 0 auto;
}
</style>
<style media="print">
  body {
    border: solid 1px #ffffff;
    margin:0;
  }
</style>
